##
# @file CMakeLists.txt
# @brief 
#/

# MODULE_PATH

set(MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})

# MODULE_NAME
get_filename_component(MODULE_NAME ${MODULE_PATH} NAME)

# LIB_SRCS
file(GLOB_RECURSE LIB_SRCS 
    "${MODULE_PATH}/src/*.c")

set(LIB_PRIVATE_INC 
    ${MODULE_PATH}/src)

# LIB_PUBLIC_INC
set(LIB_PUBLIC_INC ${MODULE_PATH}/include)

if (CONFIG_ENABLE_AI_MONITOR STREQUAL "y")
    set(AI_MONITOR_SRC 
        ${MODULE_PATH}/monitor/tuya_ai_monitor.c
        )
    set(AI_MONITOR_INC
        ${MODULE_PATH}/monitor
        )

    list(APPEND LIB_SRCS ${AI_MONITOR_SRC})
    list(APPEND LIB_PUBLIC_INC ${AI_MONITOR_INC})
endif()

########################################
# Target Configure
########################################
add_library(${MODULE_NAME})

target_sources(${MODULE_NAME}
    PRIVATE
        ${LIB_SRCS}
    )

target_include_directories(${MODULE_NAME}
    PRIVATE
        ${LIB_PRIVATE_INC}

    PUBLIC
        ${LIB_PUBLIC_INC}

    INTERFACE

    )


########################################
# Layer Configure
########################################
list(APPEND COMPONENT_LIBS ${MODULE_NAME})
set(COMPONENT_LIBS "${COMPONENT_LIBS}" PARENT_SCOPE)
list(APPEND COMPONENT_PUBINC ${LIB_PUBLIC_INC})
set(COMPONENT_PUBINC "${COMPONENT_PUBINC}" PARENT_SCOPE)
